In this tutorial, I will explain as best as I can to create Control Panels. I
will run through two different types of Control Panels:
1. Regular Control Panels
2. MDX Control Panels
If you have seen a Control Panel in any Windows operating system, you would know
what I am trying to accomplish. If you haven't seen a Control Panel before, it
is a neat, organized GUI (Graphical User Interface), where the user can
double-click on an icon, and open miscellaneous things.
You will need the following for this tutorial:
-Dialog Studio (optional, but I would rather use this)
-A copy of mIRC (obviously)
-Some icons
-MDX.dll
-Some scripting knowledge
-Some time
Onward
towards the next step....
In this section, we will create a simple Control Panel, without MDX.dll. First
and foremost, we must create the dialog. The dialog will contain:
-Icons
-Text labels
-An edit box
Here is my example code. If you would like to use it, feel free. Just change
some icons around if you want.
;alias to call dialog
alias control { dialog -m control control }
;dialog table
dialog
control {
title "Control Panel [/control]"
size -1 -1 132 80
option dbu
icon 4, 11 2 16 15, C:\mirc\System\Cpanel\AWAY.ICO, 0
text "Away System", 5, 3 20 33 8
icon 6, 44 2 16 15, C:\mirc\System\Cpanel\Anick.ico, 0
text "Auto ID", 7, 40 20 24 8, center
icon 8, 75 2 16 15, C:\mirc\System\Cpanel\CHANSETU.ICO, 0
text "Auto Join", 9, 70 20 25 8, center
icon 10, 108 2 15 15, C:\mirc\System\Cpanel\02.ICO, 0
text "Add-ons", 11, 104 20 24 8, center
icon 20, 10 36 18 15, C:\mirc\System\Cpanel\FKEYS.ICO, 0
text "F-Keys", 21, 6 54 23 8, center
icon 22, 107 33 15 18, C:\mirc\System\Cpanel\mp3.ico, 0
text "MP3 Player", 23, 99 54 32 8, center
icon 26, 42 33 17 18, C:\mirc\System\Cpanel\TELNET.ICO, 0
text "Socket Bot", 27, 37 54 29 9, center
icon 28, 75 34 17 17, C:\mirc\System\Cpanel\SETUP.ICO, 0
text "Setup", 29, 72 54 21 8, center
edit "", 1, 1 70 130 10, read
button "Button", 3, 57 85 37 12, hide ok
}
;our dialog init
on *:dialog:control:init:0: {
;shows the following text in the editbox at the bottom
when opened
did -ra $dname 1 Hover over an icon to view it's description
;sets a focus on the Setup icon
did -f $dname 28
}
on *:dialog:control:*:*: {
;our mouse events, so when the user hovers over an icon,
it will display the following text in the editbox
if ($devent == mouse) { if ($did == 4) { did -ra $dname 1 Away System, used to
go away } }
if ($devent == mouse) { if ($did == 6) { did -ra $dname 1 Auto ID, identifies to
a nickname on connect } }
if ($devent == mouse) { if ($did == 8) { did -ra $dname 1 Auto Join,
automatically joins channel on connect } }
if ($devent == mouse) { if ($did == 10) { did -ra $dname 1 Add-on Manager, load
addons with ease } }
if ($devent == mouse) { if ($did == 20) { did -ra $dname 1 Function Keys, used
to set commands for the F-Keys } }
if ($devent == mouse) { if ($did == 22) { did -ra $dname 1 MP3 Player, plays
your MP3's using a nice dialog } }
if ($devent == mouse) { if ($did == 28) { did -ra $dname 1 Setup, used to set
some options of the script } }
if ($devent == mouse) { if ($did == 26) { did -ra $dname 1 Socket bot, launches
a clone } }
;our dclick events (double-click), so when the user
double-clicks on an icon, it will open what was double-clicked on
if ($did == 4) && ($devent == dclick) { awaysys }
if ($did == 6) && ($devent == dclick) { anick }
if ($did == 8) && ($devent == dclick) { ajoin }
if ($did == 10) && ($devent == dclick) { addons }
if ($did == 20) && ($devent == dclick) { fkee }
if ($did == 22) && ($devent == dclick) { mp3 }
if ($did == 26) && ($devent == dclick) { sock }
if ($did == 28) && ($devent == dclick) { dialog -md setup setup }
}
And here is the end result:
In my opinion, the MDX Style Control Panel looks a lot more organized, and fairly neat. For this, we will use a few aliases to shorten things up. As they are:
alias mdx { return path-to\mdx.dll }
alias views { return path-to\views.mdx }
alias bars { return path-to\bars.mdx }
alias icons { return path-to-icons\ $+ $1- }
What I mean by path-to, is where MDX.dll and your icons reside. For example, the location for my MDX.dll would be system\dll\mdx\mdx.dll. Same thing with the views alias; just fill in the appropriate directory to where views.mdx resides.
Here is the code for the MDX Control Panel. This code is for learning purposes, please don't rip this code:
;alias to call dialog
alias cp { dialog -m control control }
;our dialog table
dialog
control {
title "Control Panel (/cp)"
size -1 -1 190 109
option dbu
icon $icons(cp.ico), 0
list 1, 0 2 174 93, size
list 3, 0 96 174 11, size
list 2, 175 2 14 41, size
}
;our dialog init
on *:dialog:control:init:0: {
;we MUST use these 2 lines (SetMircVersion and MarkDialog)
in order for this control panel to work. This does what the command says, marks
the ;dialog so MDX can be used, and tells MDX which version of mIRC you are
using
dll $mdx SetMircVersion $version
dll $mdx MarkDialog $dname
;sets the font for dialog id's 1 and 3 to Tahoma
dll $mdx SetFont $Dname 1,3 -11 400 Tahoma
;sets the appropiate controls. We will use Toolbar and
StatusBar
dll $mdx SetControlMDX $dname 2 Toolbar flat nodivider wrap list > $bars
dll $mdx SetControlMDX $dname 3 StatusBar > $bars
;sets the border of the ToolBar control to Staticedge
dll $mdx SetBorderStyle $dname 2 staticedge
;sets the ListView control border to Windowedge-Clientedge
dll $mdx SetBorderStyle $dname 1 windowedge clientedge
;sets the Statusbar cells, so data can be displayed in
these cells
did -i $dname 3 1 setparts 120 400
;sets the StatusBar border to Windowedge
dll $mdx SetBorderStyle $dname 3 windowedge
;sets the ToolBar button width, 16 x 16
did -i $dname 2 1 bmpsize 16 16
;sets the appropiate control for where the control panel
icons will reside, ListView
dll $mdx SetControlMDX $dname 1 listview icon single noheader flatsb > $views
;adding the appropiate icons. It would be best to put them
in the order you would like them to appear on the dialog, so you dont get
confused
did -i $dname 1 1 seticon list 0 $icons(a.ico)
did -i $dname 1 1 seticon list 0 $icons(ad.ico)
did -i $dname 1 1 seticon list 0 $icons(ai.ico)
did -i $dname 1 1 seticon list 0 $icons(aj.ico)
did -i $dname 1 1 seticon list 0 $icons(fk.ico)
did -i $dname 1 1 seticon list 0 $icons(h.ico)
did -i $dname 1 1 seticon list 0 $icons(mp3.ico)
did -i $dname 1 1 seticon list 0 $icons(prog.ico)
did -i $dname 1 1 seticon list 0 $icons(set.ico)
did -i $dname 1 1 seticon list 0 $icons(snd.ico)
did -i $dname 1 1 seticon list 0 $icons(theme.ico)
did -i $dname 1 1 seticon list 0 $icons(wp.ico)
;adding text with the icons.
did -a $dname 1 0 1 Away Options
did -a $dname 1 0 2 Addon Manager
did -a $dname 1 0 3 Auto Nick ID
did -a $dname 1 0 4 Auto Join
did -a $dname 1 0 5 Function Keys
did -a $dname 1 0 6 Help Center
did -a $dname 1 0 7 MP3 Setup
did -a $dname 1 0 8 Programs
did -a $dname 1 0 9 Script Setup
did -a $dname 1 0 10 Sounds
did -a $dname 1 0 11 Themes
did -a $dname 1 0 12 Spell Checker
;sets icons to the ToolBar control
did -i $dname 2 1 setimage icon small $icons(set.ico)
did -i $dname 2 1 setimage icon small $icons(misc.ico)
;setting the tooltip text, so when the user hovers over a
ToolBar icon, it will display the following text
did -a $dname 2 +a 1 $chr(9) $+ Displays Script functions.
did -a $dname 2 +a 2 $chr(9) $+ Displays Miscellaneous Script functions.
}
;single click commands
on *:dialog:control:sclick:1: {
;what all of this means, basically, if the user clicks on
the Away icon, it will display the appropiate alias to call the Away System, and
show basic ;information about it. Otherwise, if anything else is clicked, it
will show the alias to call it, and show basic information about it too
if ($did($dname,$did).sel == 2) { did -i $dname 3 2 /awayoptions | did -i $dname
3 3 Configure Away Options. }
elseif ($did($dname,$did).sel == 3) { did -i $dname 3 2 /addons | did -i $dname
3 3 Manage Add-ons with ease. }
elseif ($did($dname,$did).sel == 4) { did -i $dname 3 2 /autoid | did -i $dname
3 3 Configure Nicknames to Identify to. }
elseif ($did($dname,$did).sel == 5) { did -i $dname 3 2 /autojoin | did -i
$dname 3 3 Configure Channels to Join on Connect. }
elseif ($did($dname,$did).sel == 6) { did -i $dname 3 2 /fkeys | did -i $dname 3
3 Configure F-Key Bindings. }
elseif ($did($dname,$did).sel == 7) { did -i $dname 3 2 /helpcenter | did -i
$dname 3 3 Help Dialog to get help on easIRC. }
elseif ($did($dname,$did).sel == 8) { did -i $dname 3 2 /mp3 | did -i $dname 3 3
Configure MP3 Options. }
elseif ($did($dname,$did).sel == 9) { did -i $dname 3 2 /programs | did -i
$dname 3 3 Configure External Programs. }
elseif ($did($dname,$did).sel == 10) { did -i $dname 3 2 /setup | did -i $dname
3 3 Setup easIRC to your needs. }
elseif ($did($dname,$did).sel == 11) { did -i $dname 3 2 /snd | did -i $dname 3
3 Configure Sound Events. }
elseif ($did($dname,$did).sel == 12) { did -i $dname 3 2 /themes | did -i $dname
3 3 Configure which Themes to use for easIRC. }
elseif ($did($dname,$did).sel == 13) { did -i $dname 3 2 /spell | did -i $dname
3 3 Setup the Spell Checker. }
}
;our dclick events (double-click)
on *:dialog:control:dclick:1: {
;what this means, is, if anything is double clicked, it
will open the selection
if ($did($dname,$did).sel == 2) { a }
elseif ($did($dname,$did).sel == 3) { ad }
elseif ($did($dname,$did).sel == 4) { autoid }
elseif ($did($dname,$did).sel == 5) { autojoin }
elseif ($did($dname,$did).sel == 6) { fkee }
elseif ($did($dname,$did).sel == 7) { h }
elseif ($did($dname,$did).sel == 8) { mp3 }
elseif ($did($dname,$did).sel == 9) { prog }
elseif ($did($dname,$did).sel == 10) { s }
elseif ($did($dname,$did).sel == 11) { snd }
elseif ($did($dname,$did).sel == 12) { kte.load }
elseif ($did($dname,$did).sel == 13) { wp }
}
And here is the end result:
As stated before, this is meant for learning purposes only. This is easIRC's Control Panel, so please do not rip it.
-|T|urtle: My scripting buddy who helped me out on a lot of things.
-|x|neo|x|: For the idea of making a tutorial on Control Panels.
-DragonZap: MDX.dll
-lumpy-com: Longtime friend, who has helped me out over the summer.
-Khaled:
Creator of mIRC
I would like to thank YOU, for reading this as well. Without anyone to read
this, this would be pointless, right?
Any
questions, post them in the Comments section of this tutorial on
www.mircscripts.org.
You can contact me at the following:
-MSN: somebodysomeone__@hotmail.com
-IRC: DALnet. My nicknames are [AFX], Connection_Reset_By_Peer, SoMeBoDy^SoMeOnE or Zak-
You can get the essential requirements at the following:
Dialog Studio: www.mircscripts.org/dstudio/dstudio.html
MDX.dll: www.dim-bulb.net/~dragonzap/dlls/
Icons: www.customize.org